{% extends 'base.html' %}
{% load bootstrap3 i18n %}
{% block title %}{% trans 'Profile' %}{% endblock %}
{% block content %}
<div class="row">
    <div class="col-md-8">
        <h2>Settings</h2>
        <form class="form" method="post" action="">
        {% csrf_token %}
        {% bootstrap_form user_form %}
        {% bootstrap_form profile_form %}
        {% buttons submit='Save' reset='Cancel' %}
        <a href="{% url 'auth_password_change' %}" class="btn btn-danger pull-right">Change Passwod</a>
        {% endbuttons %}
        </form>
    </div>
    <div class="col-md-4">
        <h2>Api Key</h2>
        <p>
        The following key may be used to authenticate when using the
        <a href="{% url 'api:api-root' %}">API</a>.
        This key should be treated like a password.
        </p>
        <input class="form-control" value="{{ user.profile.api_token.key }}" onclick="this.select()" readonly>
        <p>If you think your API token may have been comprimised (by accidentally checking it in to
        a public source code repository, emailing it out, etc) you may revoke the token to obtain
        a new one using the button below. WARNING: This will cause any applications that use this
        token to stop working!
        </p>
        <form action="{% url 'revoke-api-token' %}" method="POST">
            {% csrf_token %}
            <input type="submit" class="btn btn-danger" value="Revoke Token" />
        </form>
    </div>
</div>
{% endblock %}
